package cn.hncu.booksManagementSystem.in.vo;
import java.io.Serializable;
/**
 * CreateTime: 2018年4月19日 下午7:16:08	
 * @author 宋进宇  Email:447441478@qq.com<br/>
 * @Description:
 *	进货明细值对象
 */
public class InDetailModel implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private String id; //进货明细编号 --- 主键
	private String inId; //进货单编号 --- 外键
	
	private String bookId; //图书编号 --- 外键
	private String bookName; //图书名称---为外键添加一个属性，提高用户体验
	
	
	public String getBookName() {
		return bookName;
	}


	public void setBookName(String bookName) {
		this.bookName = bookName;
	}


	private int sumNum; //进货数量
	private double sumMoney; //进货总金额
	//注入bookEbi
	//这样是违反设计原则的//private static BookEbi bookEbi = BookEbiFactory.getInstanceOfBookEbi();
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}


	public InDetailModel() {
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getInId() {
		return inId;
	}
	public void setInId(String inId) {
		this.inId = inId;
	}
	public String getBookId() {
		return bookId;
	}
	public void setBookId(String bookId) {
		this.bookId = bookId;
	}
	public int getSumNum() {
		return sumNum;
	}
	public void setSumNum(int sumNum) {
		this.sumNum = sumNum;
	}
	public double getSumMoney() {
		return sumMoney;
	}
	public void setSumMoney(double sumMoney) {
		this.sumMoney = sumMoney;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		InDetailModel other = (InDetailModel) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}


	@Override
	public String toString() {
		//return  "订单明细编号："+id  + " ,订单编号："+inId+ " ,图书编号："+bookId +" ,《"+bookEbi.getBookModelById(bookId).getName()+"》,共"+ sumNum + "本, " + sumMoney+"元" ;
		//上面这样做是违反设计原则，应该通过增加一个外键相对应的属性，来提高用户体验
		return "订单明细编号："+id  +" ,图书编号："+bookId +" ,《"+bookName+"》, "+ sumNum + "本 , 共：" + sumMoney+"元" ;
	}
	
	
}
